<template>
  <div >
    <el-menu style="z-index:999"
        :default-active="activeIndex"
        router
        background-color="#333744"
        text-color="#fff"
        active-text-color="#409EFF">
      <el-submenu style="float: right" index="1">
        <template slot="title">{{user.username}}</template>
        <el-menu-item index="/reset">余额: {{user.wallet}}</el-menu-item>
        <el-menu-item index="1-2" @click="logout">退出登录</el-menu-item>
      </el-submenu>
    </el-menu>
  </div>
</template>

<script>
export default {
  data() {
    return {
      activeIndex: '/content',
    };
  },
  computed:{
    user() {
     return  this.$store.state.user;
    }

  },
  created: function () {

  },
  methods: {
    logout() {
      window.sessionStorage.clear();
      this.$store.commit('resetState');
      this.$router.push('/login');
    },
  }
}
</script>

<style scoped>
.el-menu{
  height: 62px;
}
</style>
